package com.xcx.common.enums;

/**
 * 响应码枚举
 *
 * @author yangjun
 * @date 2018年7月12日 下午10:47:01
 */
public enum RespCodeEnum {

	//系统基本异常
    SUCCESS("0000", "处理成功", "SUCCESS"),
    FAIL("0001", "处理失败", "FAIL"),
    NOT_EXIST("0002", "信息不存在", "FAIL"),
    PARAM_EMPTY("0003", "参数为空", "FAIL"),
    PARAM_EMPTY_MSG("0003", "参数为空:{0}", "FAIL"),
    PARAM_ILLEGAL("0004", "参数不符合规范：{0}", "FAIL"),
    PARAM_ILLEGAL_OTHER("0005", "{0}", "FAIL"),
    PARSE_DATE_ERROR("0006", "解析异常", "FAIL"),
    INVALID_OPERATION("0007", "非法操作", "FAIL"),

    PRODUCT_CODE_FAIL("0011", "产品编号错误", "FAIL"),
    //用户处理异常
    USER_WX_AUTHORIZE_LOGIN_FAIL("0021", "微信授权登陆失败", "FAIL"),
    

    SYSTEM_ERROR("9998", "系统异常", "UN_KNOWN"),
    UN_KNOWN("9999", "未知异常", "UN_KNOWN"),;

    private String code;
    private String message;
    private String status;

    RespCodeEnum(String code, String message, String status) {
        this.code = code;
        this.message = message;
        this.status = status;
    }

    public static RespCodeEnum getRespCodeType(String code) {
        for (RespCodeEnum respCodeEnum : RespCodeEnum.values()) {
            if (respCodeEnum.code.equals(code)) {
                return respCodeEnum;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
